package tables;

import DBside.CDBox;


public abstract class AbstractEntity implements Entity{
	int id;
	String name;
	
	Boolean isInDB;
	
	public AbstractEntity(int id, String name){
		this.id = id;
		this.name = name;
		
		this.isInDB = false;
	}
	
	//****** getters *******\\

	@Override
	public int getId() {
		return this.id;
	}

	@Override
	public String getName() {
		return this.name;
	}

	
	//********* setters *****************\\
	@Override
	public void setId(int id) {
		this.id = id;
	}
	
	@Override
	public void setName(String name) {
		this.name = name;
	}
	

	
	//********* virtualId tools *********\\
	
	public Boolean getIsInDB() {
		return isInDB;
	}
	
	public Boolean isInDB() {
		return this.isInDB;
	}
	
	public void setIsInDB(Boolean isInDB) {
		this.isInDB = isInDB;
	}
	
	
	@Override
	public Boolean isValidId(){
		if(this.id < 1){
			return false;
		}else{
			return true;
		}
	}
	
	public String toString(){
		return  "id: " + getId() + "\n" +
				"name: " + getName() + "\n"; 
	}
	
	
}
